﻿// IOCPServer.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include "CIOCPServerModel.h"

#include "IOCPAppImpl.h"

#include <string>
#include <Windows.h>
#include <wtsapi32.h>
#pragma comment(lib, "wtsapi32.lib")

static DWORD WINAPI SendThreadTest(LPVOID param)
{
    int id = 0;
    char szBuf[25] = { 0 };
    while (1)
    {
        sprintf_s(szBuf, "lzlong send data %d", id++);
        CIOCPAppSrvBase::SendDataByConnectID(1, szBuf, (ULONG)(strlen(szBuf) + 1));
        Sleep(500);
    }
    return 0;
}

int main()
{
    std::cout << "Start local host, port1:12345, port2:2345 !\n";
    CAppIOCPSrvImpl* pAppSrv1 = new CAppIOCPSrvImpl("127.0.0.1", 12345); // 第一个server
    pAppSrv1->StartServer();
    CAppIOCPSrvImpl* pAppSrv2 = new CAppIOCPSrvImpl("127.0.0.1", 2345);  // 第二个server
    pAppSrv2->StartServer();

    getchar();

    CIOCPAppSrvBase::DisconnectByIOCPAppType(APP_IOCP_PROXY);

    pAppSrv1->StopServer();
    pAppSrv2->StopServer();
    delete pAppSrv1;
    delete pAppSrv2;
}

